

#ifndef EM_TOUCH_PANEL_H__
#define EM_TOUCH_PANEL_H__

#include <stdint.h>
#include <string.h> 
#include <stdbool.h>

#include "touch_algorithm.h"

typedef enum 
{
    EM_TOUCH_PANEL_EVT_TYPE_INT,
    EM_TOUCH_PANEL_EVT_TYPE_TIMEOUT,    
}em_touch_panel_evt_type_t;

typedef struct
{
    em_touch_panel_evt_type_t type; 
}em_touch_panel_evt_t;

typedef void (*em_touch_panel_evt_callback_t)( em_touch_panel_evt_t* p_evt );

// 
#define EM_TP_FW_ADDR_INTERNAL      0

typedef struct{
    uint8_t chip_id;
    uint8_t version;
}em_touch_panel_desc_t;


//typedef void (*em_touch_panel_evt_handle_t)(void);

bool em_touch_panel_mounting(uint8_t* p_chip_id, uint8_t* p_version); 

void em_touch_panel_update(void);

void em_touchpanel_enable(void);

void em_touchpanel_disable(void);

void em_touch_panel_init(void);

void em_touch_panel_init_dlps(void);

const touch_raw_data_t* em_touch_panel_dequeue(void);

/**@brief enter boot and update TP firmware
 * @param firmware_address  - the address of firmware stored; if 0, use internal firmware to update 
 * @param p_boot_progress - the progress of boot, view will update progress while OS used 
*/
void em_touch_panel_boot_update( uint32_t firmware_address, uint8_t *p_boot_progress  ) ;


void em_touch_panel_enter_dlps(void);

void em_touch_panel_exit_dlps(void); 

bool em_touch_panel_wakeup_check_allow_dlps(void);

void em_touch_panel_register_callback( em_touch_panel_evt_callback_t cb ); 


#endif 

